package com.exam.service.impl;

import java.util.List;

import com.exam.bean.PaperContentType;
import com.exam.dao.PaperContentTypeDao;
import com.exam.dao.impl.PaperContentTypeDaoImpl;
import com.exam.proxy.DynamicProxyUtil;
import com.exam.service.PaperContentTypeService;
import com.exam.util.Page;
import com.exam.util.PageResult;
import com.exam.util.PageUtil;

public class PaperContentTypeServiceImpl implements PaperContentTypeService {

	private PaperContentTypeDao dao = null;

	public PaperContentTypeServiceImpl() {
		dao = (PaperContentTypeDao) new DynamicProxyUtil()
				.bindProxy(new PaperContentTypeDaoImpl());
	}

	public boolean add(PaperContentType obj) throws Exception {
		return dao.add(obj);
	}

	public boolean delete(Integer id) throws Exception {
		return dao.delete(id);
	}

	public boolean delete(List<Integer> idList) throws Exception {
		return dao.delete(idList);
	}

	public boolean delete(String strWhere) throws Exception {
		return dao.delete(strWhere);
	}

	public int findCount(String strWhere) throws Exception {
		return dao.findCount(strWhere);
	}

	public List<PaperContentType> findList(String strWhere) throws Exception {
		return dao.findList(strWhere);
	}

	public PageResult findListByPage(Page page) throws Exception {
		page = PageUtil.createPage(page.getEveryPage(), dao.findCount(""), page
				.getCurrentPage());// // 根据总记录数创建分页信息
		List<PaperContentType> list = dao.findListByPage(page);// 通过分页条件取得信息集合
		PageResult result = new PageResult(page, list);// // 封装分页信息和记录信息，返回给调用处
		return result;
	}

	public PageResult findListByPage(String strWhere, Page page)
			throws Exception {
		page = PageUtil.createPage(page.getEveryPage(),
				dao.findCount(strWhere), page.getCurrentPage());// 根据总记录数创建分页信息
		List<PaperContentType> list = dao.findListByPage(strWhere,page);// 通过分页条件取得信息集合
		PageResult result = new PageResult(page, list);// // 封装分页信息和记录信息，返回给调用处
		return result;
	}

	public PaperContentType findModel(Integer id) throws Exception {
		return dao.findModel(id);
	}

	public boolean update(PaperContentType obj) throws Exception {
		return dao.update(obj);
	}

	public boolean update(List<PaperContentType> objList) throws Exception {
		return dao.update(objList);
	}

	public PaperContentType findOnlyModel(Integer id) throws Exception {
		return dao.findOnlyModel(id);
	}

	public boolean updateOnlyModel(PaperContentType obj) throws Exception {
		return dao.updateOnlyModel(obj);

	}
}
